$(function() {
	$.ajax({
		type: "get",
		url: "json/index.json",
		async: false,
		success: function(response, status, xhr){
			var foods = response.foods
			
			// 页面加载时渲染 功能简略图
			function food(cate) {
				$.each(cate, function(i, e) {
					$("<div class='food'></div>").html(`
						<img src="`+e.src+`" alt="">
						<span class="title">`+e.title+`</span>
					`).appendTo($(".foods"))
					// $(".hi3_case_item").eq(9).css("margin-right", "0px");
				})
			}
			food(foods)
			
			
			var shops = response.shop
			// 页面加载时渲染  商家列表
			function shop(cate) {
				$.each(cate, function(i, e) {
					$("<div class='shop'></div>").html(`
						<div class="content">
							<div class="img-box">
								<img src="`+e.src+`" alt="">
							</div>
							
							<div class="xinxi">
								<div class="dianpu">
									<span class="name">`+e.name+`</span>
									<div class="good">
										<i class="iconfont" style="font-size: 0.7rem;color: #FEC80E;">&#xe6b0;&#xe6b0;&#xe6b0;&#xe6b0;&#xe6b0;</i>
										<span class="good-text">`+e.score+`</span>
										<span class="good-text">`+e.sales+`</span>
										<span class="good-text bg-b" style="color: #FFF;margin-left: auto;">蜂鸟专送</span>
									</div>
									<div class="peisong">
										<span class="good-text">`+e.pei+`</span>
										<span class="good-text" style="margin-left: auto;">`+e.time+`</span>
									</div>
								</div>
								<div class="huodong">
									<div class="">
										<span class="species good-text">`+e.species+`</span>
									</div>
									<div class="new">
										<div class="new-icon">新</div>
										<span class="good-text">`+e.new+`</span>
										<span class="good-text" style="color: #999999;margin-left: auto;">
											`+e.hd+`个活动
											<i class="iconfont" style="font-size: 0.6rem;">&#xe65c;</i>
										</span>
									</div>
									<div class="te">
										<div class="te-icon">新</div>
										<span class="good-text">`+e.te+`</span>
									</div>
								</div>
							</div>
						</div>
					`).appendTo($(".shop-list"))
					console.log(e.src)
				})
			}
			shop(shops)
			$(".shop").click(function() {
				window.location.href = "shop-details.html"
			})
		}
	})

})

